package cn.wzvtc.miniserver;

import cn.wzvtc.common.vo.Result;
import org.springframework.web.bind.annotation.*;

import java.util.List;

public class UserController {

    private UserService userService;

    public UserController(UserService userService) {
        this.userService = userService;
    }

    public Result list() {
        List<User> userList = userService.findAll();
        return Result.ok().put("list", userList);
    }

    public Result add(User user) {
        userService.insert(user);
        return Result.ok();
    }

}
